package com.t2t.top.devops.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 地址跳转.
 *
 * @author yangpengfei
 */
@Controller
@RequestMapping("/api/url")
public class UrlController  {

    private Logger log = LoggerFactory.getLogger(UrlController.class);

    @RequestMapping("/login")
    public String login() {
        return "login";
    }

    /**
     * 通用页面跳转.
     * 规则：iframe-top --> /jsp/iframe/top.jsp
     *
     * @param url
     */
    @RequestMapping("/{url}")
    public String url(@PathVariable(value = "url") String url) {
        try {
            url = url.replace("-", "/");
            return url;
        } catch (Exception e) {
            log.error("登录失败", e);
            return "login";
        }

    }

}
